package com.bjgzy.courselive.mvp.model;

import com.bjgzy.courselive.mvp.contract.OrderPayContract;
import com.eduhzy.ttw.commonsdk.entity.AliOrderData;
import com.eduhzy.ttw.commonsdk.entity.CommonData;
import com.eduhzy.ttw.commonsdk.entity.OrderPayStatus;
import com.eduhzy.ttw.commonsdk.entity.RightOrderInfo;
import com.eduhzy.ttw.commonsdk.entity.WXPayData;
import com.eduhzy.ttw.commonsdk.http.CommonApi;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * @author xubo
 * @date 2018-8-3 13:44:39
 */
@ActivityScope
public class OrderPayModel extends BaseModel implements OrderPayContract.Model {


    @Inject
    public OrderPayModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public Observable<CommonData<List<RightOrderInfo>>> saveRightOrder(Map<String, Object> map) {

        return mRepositoryManager.obtainRetrofitService(CommonApi.class).saveRightOrder(map);
    }

    @Override
    public Observable<CommonData<AliOrderData>> getAliPayOrderInfo(Map<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(CommonApi.class).alipay(map);
    }

    @Override
    public Observable<CommonData<WXPayData>> getWxPayOrderInfo(Map<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(CommonApi.class).getWxPayOrderInfo(map);
    }

    @Override
    public Observable<CommonData<Map>> orderPaid(Map<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(CommonApi.class).orderPaid(map);
    }

    @Override
    public Observable<CommonData<OrderPayStatus>> getOrderPayStatus(Map<String, Object> map) {
        return mRepositoryManager.obtainRetrofitService(CommonApi.class).getOrderPayStatus(map);
    }
}